import bean.User;
import top.malaoshi.jdbc.ConnectionFactory;
import top.malaoshi.jdbc.Db;
import top.malaoshi.jdbc.DbImpl;
import top.malaoshi.util.Out;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class QuerySQLite {

    public static void main(String[] args) throws SQLException, ClassNotFoundException, IntrospectionException, NoSuchFieldException, InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException {
        Connection connect = ConnectionFactory.connect("org.sqlite.JDBC",
                "jdbc:sqlite:D:\\mym\\airship1.1\\out\\artifacts\\airship1_1_war_exploded\\WEB-INF\\netdisk.db",
                "", "");
        Db db = new DbImpl(connect);

        String sql = "select uid,username from t_user where username = #{username} and password = #{password}";
        Map map = new HashMap();
        map.put("username", "admin");
        map.put("password", "123456");
        List list = db.queryTag(User.class,sql, map);
        Out.printList(list);
        db.close();
    }
}
